Skip to content

Conversation

@ziggie1984
Copy link
Collaborator

@ziggie1984 ziggie1984 commented Nov 26, 2025

backports #10394

@ziggie1984 ziggie1984 force-pushed the backport/add-back-globallock branch from dd44b40 to 45ea9d6 Compare November 27, 2025 20:10
@ziggie1984 ziggie1984 marked this pull request as ready for review November 27, 2025 20:11
@ziggie1984 ziggie1984 force-pushed the backport/add-back-globallock branch from 45ea9d6 to 6d99e68 Compare November 28, 2025 07:55
Add two configuration options to control global lock usage for
different postgres database backends:

- ChannelDBWithGlobalLock: for channeldb access (default: false)
- WalletDBWithGlobalLock: for wallet database access (default: true)

These allow fine-grained control over which databases use global
locks, rather than hardcoding the behavior. This is a temporary
measure until the revocation log and wallet are migrated to native
SQL and become fully concurrent-safe.
@ziggie1984 ziggie1984 force-pushed the backport/add-back-globallock branch 2 times, most recently from 1d1ccc7 to e8a803b Compare November 28, 2025 08:35
Replace hardcoded WithGlobalLock assignment with configurable
options wallet postgres backends. Also add the WithGlobalLock
option to the channeldb table for postgres backends.

Defaults:
- channeldb: false (allow concurrent access)
- wallet: true (maintain safe single-writer behavior)

Users can now override these defaults via:
- db.postgres.channeldb-with-global-lock
- db.postgres.walletdb-with-global-lock

This gives operators flexibility while maintaining safe defaults
until full native SQL migration is complete.

Moreover exclude db.postgres.walletdb-with-global-lock check
in the sample config file script. We cannot easily check the
correct default because we set it later in the LND startup
sequence so we exclude it.
@ziggie1984 ziggie1984 force-pushed the backport/add-back-globallock branch from e8a803b to 6bdfb1d Compare November 28, 2025 08:36
@ziggie1984 ziggie1984 self-assigned this Dec 1, 2025
@ziggie1984
Copy link
Collaborator Author

ziggie1984 commented Dec 1, 2025

short note here, this backport is a bit different to the master PR because we had to add the relativ sqldb reference here, since in master this reference to the local sqldb package was already present.

@ziggie1984 ziggie1984 requested a review from starius December 1, 2025 19:31
Copy link
Collaborator

@starius starius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 💾

Copy link
Collaborator

@saubyk saubyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack


// Use the local sqldb package for development.
// TODO(norbert): remove once sqldb package is tagged.
replace github.com/lightningnetwork/lnd/sqldb => ./sqldb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to tag post merge.

@Roasbeef Roasbeef merged commit 4eaf57d into lightningnetwork:v0.20.x-branch Dec 1, 2025
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants